<?php
namespace app\api\validate;

use think\Validate;

class Task extends Validate
{

    /**
     * 验证规则
     */
    protected $rule = [
        'date'                          => 'require|date',
//         'report_number'                 => 'require',
//         'models'                        => 'require',
        'car_number'                    => 'require',
        'area_text'                     => 'require',
        'address'                       => 'require',
//        'name_4s'                       => 'require',
//        'insurance_company_id'          => 'require',
        'receptionist'                  => 'require',
        'pick_uid'                      => 'require',
//         'sure_name'                     => 'require',
//         'return_id'                     => 'require',
        'warning_type'                  => 'require',
        'pick_hours'                    => 'integer',
//         'price'                         => 'require',
        'content'                       => 'require',
        'remark'                        => 'require',
        'images'                        => 'require|array',
        'servicing_images'              => 'require|array',
        'serviced_images'               => 'require|array',
        'mobile_jd'                     => 'regex:1[3-9]\d{9}',
        'mobile_ds'                     => 'regex:1[3-9]\d{9}',
        'id'                            => 'require',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'date.require'                      => '开单日期不能为空',
        'date.date'                         => '开单日期数据类型不正确',
        'report_number.require'             => '报案号不能为空',
        'models.require'                    => '车辆型号不能为空',
        'car_number.require'                => '车牌号不能为空',
        'area_text.require'                 => '请选择省市区',
        'address.require'                   => '详细地址不能为空',
        'name_4s.require'                   => '4s店名称不能为空',
        'insurance_company_id.require'      => '保险公司不能为空',
        'receptionist.require'              => '业务接待员不能为空',
        'pick_uid.require'                  => '取件人不能为空',
        'sure_name.require'                 => '定损人不能为空',
        'return_id.require'                 => '回款方式不能为空',
        'warning_type.require'              => '紧急程度不能为空',
        'pick_hours.integer'                => '取件时效只能是整数',
        'price.require'                     => '金额不能为空',
        'content.require'                   => '修复件内容不能为空',
        'remark.require'                    => '备注不能为空',
        'images.require'                    => '图片不能为空',
        'images.array'                      => '图片格式不正确',
        'servicing_images.require'          => '维修中照片不能为空',
        'serviced_images.require'           => '维修完成照片不能为空',
        'service_cancel_memo.require'       => '原因不能为空',
        'mobile_jd.regex'                   => '接待电话不正确',
        'mobile_ds.regex'                   => '定损电话不正确',
    ];

    /**
     * 字段描述
     */
    protected $field = [

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'edit' => ['date','report_number','models','car_number','area_text','address','name_4s','insurance_company_id','receptionist','pick_uid','sure_name','return_id','pick_hours','price','content','mobile_jd','mobile_ds'],
        'pick'  => ['id','images'],
        'deliver'  => ['id','images'],
        'service_start'  => ['id','images'],
        'service_cancel'  => ['id','images','service_cancel_memo'],
        'service'  => ['id','serviced_images'],
        'return'  => ['id','images'],
        'settlement'  => ['id','return_id','price','remark'],
    ];

}
